package url;

import java.io.*;
import java.net.URL;

public class Test {
	public static void main(String[] args) throws IOException {
		
		String urltext = "http://es.wikipedia.org/wiki/Eric_Clapton";
		
		URL url = new URL(urltext);
		BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
		String inputLine;

		
		FileWriter fichero = null;
		PrintWriter pw = null;
		try{
			 
		 	fichero = new FileWriter("src/jdom/url.xml",true);
		 	pw = new PrintWriter(fichero);
		 	

		
		while ((inputLine = in.readLine()) != null) {
			// Process each line.
			pw.println(inputLine);
			//System.out.println(inputLine);
		}
		in.close();
		
		
		 } catch (Exception e) {
	            e.printStackTrace();
	 	} finally {
	           try {
	           if (null != fichero)
	              fichero.close();
	           } catch (Exception e2) {
	              e2.printStackTrace();
	           }
	     }
	}
}



